home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Draw / CBitmapStrip.as next >
Text File  |  2011-08-19  |  8KB  |  265 lines

  1. package Local.Draw
  2. {
  3.    import flash.display.BitmapData;
  4.    import flash.events.EventDispatcher;
  5.    import flash.geom.Point;
  6.    import flash.geom.Rectangle;
  7.    
  8.    public class CBitmapStrip extends EventDispatcher
  9.    {
  10.       
  11.       public static const mDefaultWidth:int = 50;
  12.       
  13.       public static const zPoint:Point = new Point(0,0);
  14.       
  15.       public static const mDefaultWidthScalar:Number = 1 / mDefaultWidth;
  16.        
  17.       
  18.       public var mBackground:Boolean;
  19.       
  20.       public var mBMD:BitmapData;
  21.       
  22.       public var mDisplacementLow:int;
  23.       
  24.       public var mDisplayRect:Rectangle;
  25.       
  26.       public var mFineAltitudes:Array;
  27.       
  28.       public var mDisplacement:int;
  29.       
  30.       public var mName:String;
  31.       
  32.       public var mAltitudes:Array;
  33.       
  34.       public var mNext:CBitmapStrip;
  35.       
  36.       public var mOpaque:Boolean;
  37.       
  38.       public function CBitmapStrip(param1:String, param2:BitmapData, param3:Boolean = false, param4:Boolean = false)
  39.       {
  40.          if(true)
  41.          {
  42.             super();
  43.             if(true)
  44.             {
  45.                mBackground = param3;
  46.                if(true)
  47.                {
  48.                   mName = param1;
  49.                }
  50.                mOpaque = param4;
  51.             }
  52.             ScanBitmap(param2);
  53.          }
  54.       }
  55.       
  56.       public function ScanAltitudes() : void
  57.       {
  58.          var _loc1_:int = 0;
  59.          var _loc2_:int = 0;
  60.          var _loc3_:int = 0;
  61.          var _loc4_:int = 0;
  62.          var _loc5_:int = 0;
  63.          if(true)
  64.          {
  65.             mAltitudes = new Array();
  66.             if(true)
  67.             {
  68.                mFineAltitudes = new Array();
  69.                if(true)
  70.                {
  71.                   if(mOpaque)
  72.                   {
  73.                      ┬º┬ºgoto(addr35);
  74.                   }
  75.                   else
  76.                   {
  77.                      _loc5_ = 0;
  78.                      if(true)
  79.                      {
  80.                         _loc3_ = 0;
  81.                         if(true)
  82.                         {
  83.                            ┬º┬ºgoto(addr155);
  84.                         }
  85.                         ┬º┬ºgoto(addr136);
  86.                      }
  87.                   }
  88.                   ┬º┬ºgoto(addr148);
  89.                }
  90.                addr35:
  91.                _loc2_ = 0;
  92.                ┬º┬ºgoto(addr37);
  93.             }
  94.             addr37:
  95.             _loc3_ = 0;
  96.             ┬º┬ºgoto(addr39);
  97.          }
  98.          addr39:
  99.          loop6:
  100.          while(true)
  101.          {
  102.             if(_loc3_ >= mBMD.width)
  103.             {
  104.                if(false)
  105.                {
  106.                   loop1:
  107.                   for(; _loc4_ < mBMD.height; _loc4_++)
  108.                   {
  109.                      var _loc6_:*;
  110.                      ┬º┬ºpush(_loc6_ = mBMD.getPixel32(_loc3_,_loc4_) >>> 24);
  111.                      if(true)
  112.                      {
  113.                         _loc1_ = ┬º┬ºpop();
  114.                         ┬º┬ºpush(_loc6_);
  115.                      }
  116.                      while(true)
  117.                      {
  118.                         if(┬º┬ºpop() == 0)
  119.                         {
  120.                            continue loop1;
  121.                         }
  122.                         while(true)
  123.                         {
  124.                            mAltitudes[_loc3_] = _loc4_ + mDisplacement;
  125.                            addr136:
  126.                            while(true)
  127.                            {
  128.                               mFineAltitudes[_loc3_] = _loc4_ + mDisplacement + (1 - _loc1_ / 255);
  129.                               addr148:
  130.                               while(true)
  131.                               {
  132.                                  break loop1;
  133.                               }
  134.                            }
  135.                         }
  136.                      }
  137.                   }
  138.                   loop5:
  139.                   while(true)
  140.                   {
  141.                      _loc3_++;
  142.                      addr155:
  143.                      while(_loc3_ < mBMD.width)
  144.                      {
  145.                         _loc4_ = 0;
  146.                         if(true)
  147.                         {
  148.                            ┬º┬ºgoto(addr150);
  149.                         }
  150.                         ┬º┬ºgoto(addr130);
  151.                         continue loop5;
  152.                      }
  153.                   }
  154.                   addr150:
  155.                   addr154:
  156.                }
  157.                addr159:
  158.                mDisplacementLow = 0;
  159.                addr162:
  160.                _loc6_ = 0;
  161.                if(true)
  162.                {
  163.                   var _loc7_:* = mAltitudes;
  164.                   if(true)
  165.                   {
  166.                   }
  167.                   for each(_loc1_ in _loc7_)
  168.                   {
  169.                      mDisplacementLow = _loc1_ > mDisplacementLow ? int(_loc1_) : int(mDisplacementLow);
  170.                   }
  171.                }
  172.                addr192:
  173.                ┬º┬ºpush((_loc6_ = ┬º┬ºfindproperty(mDisplacementLow)).mDisplacementLow);
  174.                if(true)
  175.                {
  176.                   ┬º┬ºpush(┬º┬ºpop() + 1);
  177.                }
  178.                _loc7_ = ┬º┬ºpop();
  179.                if(true)
  180.                {
  181.                   _loc6_.mDisplacementLow = _loc7_;
  182.                }
  183.                break;
  184.             }
  185.             _loc4_ = mBMD.height - 1;
  186.             if(true)
  187.             {
  188.                while(true)
  189.                {
  190.                   if(_loc4_ >= 0)
  191.                   {
  192.                      ┬º┬ºpush(mBMD.getPixel32(_loc3_,_loc4_) >>> 24);
  193.                      if(true)
  194.                      {
  195.                         if(┬º┬ºpop() != 255)
  196.                         {
  197.                            if(true)
  198.                            {
  199.                               mAltitudes[_loc3_] = _loc4_ + mDisplacement;
  200.                               if(true)
  201.                               {
  202.                                  ┬º┬ºgoto(addr81);
  203.                               }
  204.                               ┬º┬ºgoto(addr162);
  205.                            }
  206.                            ┬º┬ºgoto(addr192);
  207.                         }
  208.                         else
  209.                         {
  210.                            _loc4_--;
  211.                            if(true)
  212.                            {
  213.                               continue;
  214.                            }
  215.                         }
  216.                      }
  217.                      break;
  218.                   }
  219.                   if(true)
  220.                   {
  221.                      addr81:
  222.                      _loc3_++;
  223.                      if(true)
  224.                      {
  225.                         continue loop6;
  226.                      }
  227.                      ┬º┬ºgoto(addr154);
  228.                   }
  229.                   ┬º┬ºgoto(addr155);
  230.                   ┬º┬ºgoto(addr159);
  231.                }
  232.                ┬º┬ºgoto(addr128);
  233.             }
  234.             break;
  235.             ┬º┬ºgoto(addr128);
  236.          }
  237.       }
  238.       
  239.       public function ScanBitmap(param1:BitmapData) : void
  240.       {
  241.          var _loc2_:Rectangle = null;
  242.          _loc2_ = param1.getColorBoundsRect(4278190080,0,false);
  243.          if(true)
  244.          {
  245.             mDisplayRect = new Rectangle(0,_loc2_.y,CBitmapStrip.mDefaultWidth,Math.max(1,_loc2_.height));
  246.             if(true)
  247.             {
  248.                mDisplacement = mDisplayRect.y;
  249.                if(true)
  250.                {
  251.                   mBMD = new BitmapData(mDisplayRect.width,mDisplayRect.height,true,0);
  252.                }
  253.                mBMD.copyPixels(param1,mDisplayRect,zPoint,null,null,true);
  254.             }
  255.             ScanAltitudes();
  256.          }
  257.       }
  258.       
  259.       public function get mMemSize() : uint
  260.       {
  261.          return mBMD.width * mBMD.height * 4;
  262.       }
  263.    }
  264. }
  265.